package cn.itheima.taotao.controller;

import cn.itheima.taotao.domain.DataGridResult;
import cn.itheima.taotao.domain.Item;
import cn.itheima.taotao.domain.TaotaoResult;
import cn.itheima.taotao.service.ItemService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * Created by Administrator .
 */
@Controller
public class ItemController {

    @Resource
    private ItemService itemService;

    @RequestMapping("/item/list")
    @ResponseBody
    public DataGridResult getItemList(Integer page, Integer rows) {
        DataGridResult dataGridResult = itemService.getItemList(page, rows);
        return dataGridResult;
    }

    @RequestMapping("/item/save")
    @ResponseBody
    public TaotaoResult saveItem(Item item, String desc) {
        TaotaoResult taotaoResult = itemService.saveTtem(item, desc);
        return taotaoResult;
    }
}
